// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Serverless.Fluent;
using Elastic.Clients.Elasticsearch.Serverless.Requests;
using Elastic.Clients.Elasticsearch.Serverless.Serialization;
using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Serverless.IndexManagement;

public sealed class SimulateIndexTemplateRequestParameters : RequestParameters
{
	/// <summary>
	/// <para>If `true`, the template passed in the body is only used if no existing<br/>templates match the same index patterns. If `false`, the simulation uses<br/>the template with the highest priority. Note that the template is not<br/>permanently added or updated in either case; it is only used for the<br/>simulation.</para>
	/// </summary>
	public bool? Create { get => Q<bool?>("create"); set => Q("create", value); }

	/// <summary>
	/// <para>Period to wait for a connection to the master node. If no response is received<br/>before the timeout expires, the request fails and returns an error.</para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Serverless.Duration? MasterTimeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("master_timeout"); set => Q("master_timeout", value); }

	/// <summary>
	/// <para>If true, returns all relevant default configurations for the index template.</para>
	/// </summary>
	public bool? IncludeDefaults { get => Q<bool?>("include_defaults"); set => Q("include_defaults", value); }
}

public sealed partial class SimulateIndexTemplateRequest : PlainRequest<SimulateIndexTemplateRequestParameters>
{
	public SimulateIndexTemplateRequest(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSimulateIndexTemplate;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => true;

	internal override string OperationName => "indices.simulate_index_template";

	/// <summary>
	/// <para>If `true`, the template passed in the body is only used if no existing<br/>templates match the same index patterns. If `false`, the simulation uses<br/>the template with the highest priority. Note that the template is not<br/>permanently added or updated in either case; it is only used for the<br/>simulation.</para>
	/// </summary>
	[JsonIgnore]
	public bool? Create { get => Q<bool?>("create"); set => Q("create", value); }

	/// <summary>
	/// <para>Period to wait for a connection to the master node. If no response is received<br/>before the timeout expires, the request fails and returns an error.</para>
	/// </summary>
	[JsonIgnore]
	public Elastic.Clients.Elasticsearch.Serverless.Duration? MasterTimeout { get => Q<Elastic.Clients.Elasticsearch.Serverless.Duration?>("master_timeout"); set => Q("master_timeout", value); }

	/// <summary>
	/// <para>If true, returns all relevant default configurations for the index template.</para>
	/// </summary>
	[JsonIgnore]
	public bool? IncludeDefaults { get => Q<bool?>("include_defaults"); set => Q("include_defaults", value); }

	/// <summary>
	/// <para>This setting overrides the value of the `action.auto_create_index` cluster setting.<br/>If set to `true` in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via `actions.auto_create_index`.<br/>If set to `false`, then indices or data streams matching the template must always be explicitly created, and may never be automatically created.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("allow_auto_create")]
	public bool? AllowAutoCreate { get; set; }

	/// <summary>
	/// <para>Array of wildcard (`*`) expressions used to match the names of data streams and indices during creation.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("index_patterns")]
	public Elastic.Clients.Elasticsearch.Serverless.Indices? IndexPatterns { get; set; }

	/// <summary>
	/// <para>An ordered list of component template names.<br/>Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("composed_of")]
	public ICollection<string>? ComposedOf { get; set; }

	/// <summary>
	/// <para>Template to be applied.<br/>It may optionally include an `aliases`, `mappings`, or `settings` configuration.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("template")]
	public Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexTemplateMapping? Template { get; set; }

	/// <summary>
	/// <para>If this object is included, the template is used to create data streams and their backing indices.<br/>Supports an empty object.<br/>Data streams require a matching index template with a `data_stream` object.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("data_stream")]
	public Elastic.Clients.Elasticsearch.Serverless.IndexManagement.DataStreamVisibility? DataStream { get; set; }

	/// <summary>
	/// <para>Priority to determine index template precedence when a new data stream or index is created.<br/>The index template with the highest priority is chosen.<br/>If no priority is specified the template is treated as though it is of priority 0 (lowest priority).<br/>This number is not automatically generated by Elasticsearch.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("priority")]
	public int? Priority { get; set; }

	/// <summary>
	/// <para>Version number used to manage index templates externally.<br/>This number is not automatically generated by Elasticsearch.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("version")]
	public long? Version { get; set; }

	/// <summary>
	/// <para>Optional user metadata about the index template.<br/>May have any contents.<br/>This map is not automatically generated by Elasticsearch.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("_meta")]
	public IDictionary<string, object>? Meta { get; set; }
}

public sealed partial class SimulateIndexTemplateRequestDescriptor<TDocument> : RequestDescriptor<SimulateIndexTemplateRequestDescriptor<TDocument>, SimulateIndexTemplateRequestParameters>
{
	internal SimulateIndexTemplateRequestDescriptor(Action<SimulateIndexTemplateRequestDescriptor<TDocument>> configure) => configure.Invoke(this);

	public SimulateIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name))
	{
	}

	internal SimulateIndexTemplateRequestDescriptor()
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSimulateIndexTemplate;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => true;

	internal override string OperationName => "indices.simulate_index_template";

	public SimulateIndexTemplateRequestDescriptor<TDocument> Create(bool? create = true) => Qs("create", create);
	public SimulateIndexTemplateRequestDescriptor<TDocument> IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults);
	public SimulateIndexTemplateRequestDescriptor<TDocument> MasterTimeout(Elastic.Clients.Elasticsearch.Serverless.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);

	public SimulateIndexTemplateRequestDescriptor<TDocument> Name(Elastic.Clients.Elasticsearch.Serverless.Name name)
	{
		RouteValues.Required("name", name);
		return Self;
	}

	private Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexTemplateMapping? TemplateValue { get; set; }
	private IndexTemplateMappingDescriptor<TDocument> TemplateDescriptor { get; set; }
	private Action<IndexTemplateMappingDescriptor<TDocument>> TemplateDescriptorAction { get; set; }
	private IDictionary<string, object>? MetaValue { get; set; }
	private bool? AllowAutoCreateValue { get; set; }
	private ICollection<string>? ComposedOfValue { get; set; }
	private Elastic.Clients.Elasticsearch.Serverless.IndexManagement.DataStreamVisibility? DataStreamValue { get; set; }
	private DataStreamVisibilityDescriptor DataStreamDescriptor { get; set; }
	private Action<DataStreamVisibilityDescriptor> DataStreamDescriptorAction { get; set; }
	private Elastic.Clients.Elasticsearch.Serverless.Indices? IndexPatternsValue { get; set; }
	private int? PriorityValue { get; set; }
	private long? VersionValue { get; set; }

	/// <summary>
	/// <para>Template to be applied.<br/>It may optionally include an `aliases`, `mappings`, or `settings` configuration.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor<TDocument> Template(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexTemplateMapping? template)
	{
		TemplateDescriptor = null;
		TemplateDescriptorAction = null;
		TemplateValue = template;
		return Self;
	}

	public SimulateIndexTemplateRequestDescriptor<TDocument> Template(IndexTemplateMappingDescriptor<TDocument> descriptor)
	{
		TemplateValue = null;
		TemplateDescriptorAction = null;
		TemplateDescriptor = descriptor;
		return Self;
	}

	public SimulateIndexTemplateRequestDescriptor<TDocument> Template(Action<IndexTemplateMappingDescriptor<TDocument>> configure)
	{
		TemplateValue = null;
		TemplateDescriptor = null;
		TemplateDescriptorAction = configure;
		return Self;
	}

	/// <summary>
	/// <para>Optional user metadata about the index template.<br/>May have any contents.<br/>This map is not automatically generated by Elasticsearch.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor<TDocument> Meta(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> selector)
	{
		MetaValue = selector?.Invoke(new FluentDictionary<string, object>());
		return Self;
	}

	/// <summary>
	/// <para>This setting overrides the value of the `action.auto_create_index` cluster setting.<br/>If set to `true` in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via `actions.auto_create_index`.<br/>If set to `false`, then indices or data streams matching the template must always be explicitly created, and may never be automatically created.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor<TDocument> AllowAutoCreate(bool? allowAutoCreate = true)
	{
		AllowAutoCreateValue = allowAutoCreate;
		return Self;
	}

	/// <summary>
	/// <para>An ordered list of component template names.<br/>Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor<TDocument> ComposedOf(ICollection<string>? composedOf)
	{
		ComposedOfValue = composedOf;
		return Self;
	}

	/// <summary>
	/// <para>If this object is included, the template is used to create data streams and their backing indices.<br/>Supports an empty object.<br/>Data streams require a matching index template with a `data_stream` object.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor<TDocument> DataStream(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.DataStreamVisibility? dataStream)
	{
		DataStreamDescriptor = null;
		DataStreamDescriptorAction = null;
		DataStreamValue = dataStream;
		return Self;
	}

	public SimulateIndexTemplateRequestDescriptor<TDocument> DataStream(DataStreamVisibilityDescriptor descriptor)
	{
		DataStreamValue = null;
		DataStreamDescriptorAction = null;
		DataStreamDescriptor = descriptor;
		return Self;
	}

	public SimulateIndexTemplateRequestDescriptor<TDocument> DataStream(Action<DataStreamVisibilityDescriptor> configure)
	{
		DataStreamValue = null;
		DataStreamDescriptor = null;
		DataStreamDescriptorAction = configure;
		return Self;
	}

	/// <summary>
	/// <para>Array of wildcard (`*`) expressions used to match the names of data streams and indices during creation.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor<TDocument> IndexPatterns(Elastic.Clients.Elasticsearch.Serverless.Indices? indexPatterns)
	{
		IndexPatternsValue = indexPatterns;
		return Self;
	}

	/// <summary>
	/// <para>Priority to determine index template precedence when a new data stream or index is created.<br/>The index template with the highest priority is chosen.<br/>If no priority is specified the template is treated as though it is of priority 0 (lowest priority).<br/>This number is not automatically generated by Elasticsearch.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor<TDocument> Priority(int? priority)
	{
		PriorityValue = priority;
		return Self;
	}

	/// <summary>
	/// <para>Version number used to manage index templates externally.<br/>This number is not automatically generated by Elasticsearch.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor<TDocument> Version(long? version)
	{
		VersionValue = version;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		if (TemplateDescriptor is not null)
		{
			writer.WritePropertyName("template");
			JsonSerializer.Serialize(writer, TemplateDescriptor, options);
		}
		else if (TemplateDescriptorAction is not null)
		{
			writer.WritePropertyName("template");
			JsonSerializer.Serialize(writer, new IndexTemplateMappingDescriptor<TDocument>(TemplateDescriptorAction), options);
		}
		else if (TemplateValue is not null)
		{
			writer.WritePropertyName("template");
			JsonSerializer.Serialize(writer, TemplateValue, options);
		}

		if (MetaValue is not null)
		{
			writer.WritePropertyName("_meta");
			JsonSerializer.Serialize(writer, MetaValue, options);
		}

		if (AllowAutoCreateValue.HasValue)
		{
			writer.WritePropertyName("allow_auto_create");
			writer.WriteBooleanValue(AllowAutoCreateValue.Value);
		}

		if (ComposedOfValue is not null)
		{
			writer.WritePropertyName("composed_of");
			JsonSerializer.Serialize(writer, ComposedOfValue, options);
		}

		if (DataStreamDescriptor is not null)
		{
			writer.WritePropertyName("data_stream");
			JsonSerializer.Serialize(writer, DataStreamDescriptor, options);
		}
		else if (DataStreamDescriptorAction is not null)
		{
			writer.WritePropertyName("data_stream");
			JsonSerializer.Serialize(writer, new DataStreamVisibilityDescriptor(DataStreamDescriptorAction), options);
		}
		else if (DataStreamValue is not null)
		{
			writer.WritePropertyName("data_stream");
			JsonSerializer.Serialize(writer, DataStreamValue, options);
		}

		if (IndexPatternsValue is not null)
		{
			writer.WritePropertyName("index_patterns");
			JsonSerializer.Serialize(writer, IndexPatternsValue, options);
		}

		if (PriorityValue.HasValue)
		{
			writer.WritePropertyName("priority");
			writer.WriteNumberValue(PriorityValue.Value);
		}

		if (VersionValue is not null)
		{
			writer.WritePropertyName("version");
			JsonSerializer.Serialize(writer, VersionValue, options);
		}

		writer.WriteEndObject();
	}
}

public sealed partial class SimulateIndexTemplateRequestDescriptor : RequestDescriptor<SimulateIndexTemplateRequestDescriptor, SimulateIndexTemplateRequestParameters>
{
	internal SimulateIndexTemplateRequestDescriptor(Action<SimulateIndexTemplateRequestDescriptor> configure) => configure.Invoke(this);

	public SimulateIndexTemplateRequestDescriptor(Elastic.Clients.Elasticsearch.Serverless.Name name) : base(r => r.Required("name", name))
	{
	}

	internal SimulateIndexTemplateRequestDescriptor()
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.IndexManagementSimulateIndexTemplate;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => true;

	internal override string OperationName => "indices.simulate_index_template";

	public SimulateIndexTemplateRequestDescriptor Create(bool? create = true) => Qs("create", create);
	public SimulateIndexTemplateRequestDescriptor IncludeDefaults(bool? includeDefaults = true) => Qs("include_defaults", includeDefaults);
	public SimulateIndexTemplateRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Serverless.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);

	public SimulateIndexTemplateRequestDescriptor Name(Elastic.Clients.Elasticsearch.Serverless.Name name)
	{
		RouteValues.Required("name", name);
		return Self;
	}

	private Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexTemplateMapping? TemplateValue { get; set; }
	private IndexTemplateMappingDescriptor TemplateDescriptor { get; set; }
	private Action<IndexTemplateMappingDescriptor> TemplateDescriptorAction { get; set; }
	private IDictionary<string, object>? MetaValue { get; set; }
	private bool? AllowAutoCreateValue { get; set; }
	private ICollection<string>? ComposedOfValue { get; set; }
	private Elastic.Clients.Elasticsearch.Serverless.IndexManagement.DataStreamVisibility? DataStreamValue { get; set; }
	private DataStreamVisibilityDescriptor DataStreamDescriptor { get; set; }
	private Action<DataStreamVisibilityDescriptor> DataStreamDescriptorAction { get; set; }
	private Elastic.Clients.Elasticsearch.Serverless.Indices? IndexPatternsValue { get; set; }
	private int? PriorityValue { get; set; }
	private long? VersionValue { get; set; }

	/// <summary>
	/// <para>Template to be applied.<br/>It may optionally include an `aliases`, `mappings`, or `settings` configuration.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor Template(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.IndexTemplateMapping? template)
	{
		TemplateDescriptor = null;
		TemplateDescriptorAction = null;
		TemplateValue = template;
		return Self;
	}

	public SimulateIndexTemplateRequestDescriptor Template(IndexTemplateMappingDescriptor descriptor)
	{
		TemplateValue = null;
		TemplateDescriptorAction = null;
		TemplateDescriptor = descriptor;
		return Self;
	}

	public SimulateIndexTemplateRequestDescriptor Template(Action<IndexTemplateMappingDescriptor> configure)
	{
		TemplateValue = null;
		TemplateDescriptor = null;
		TemplateDescriptorAction = configure;
		return Self;
	}

	/// <summary>
	/// <para>Optional user metadata about the index template.<br/>May have any contents.<br/>This map is not automatically generated by Elasticsearch.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor Meta(Func<FluentDictionary<string, object>, FluentDictionary<string, object>> selector)
	{
		MetaValue = selector?.Invoke(new FluentDictionary<string, object>());
		return Self;
	}

	/// <summary>
	/// <para>This setting overrides the value of the `action.auto_create_index` cluster setting.<br/>If set to `true` in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via `actions.auto_create_index`.<br/>If set to `false`, then indices or data streams matching the template must always be explicitly created, and may never be automatically created.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor AllowAutoCreate(bool? allowAutoCreate = true)
	{
		AllowAutoCreateValue = allowAutoCreate;
		return Self;
	}

	/// <summary>
	/// <para>An ordered list of component template names.<br/>Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor ComposedOf(ICollection<string>? composedOf)
	{
		ComposedOfValue = composedOf;
		return Self;
	}

	/// <summary>
	/// <para>If this object is included, the template is used to create data streams and their backing indices.<br/>Supports an empty object.<br/>Data streams require a matching index template with a `data_stream` object.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor DataStream(Elastic.Clients.Elasticsearch.Serverless.IndexManagement.DataStreamVisibility? dataStream)
	{
		DataStreamDescriptor = null;
		DataStreamDescriptorAction = null;
		DataStreamValue = dataStream;
		return Self;
	}

	public SimulateIndexTemplateRequestDescriptor DataStream(DataStreamVisibilityDescriptor descriptor)
	{
		DataStreamValue = null;
		DataStreamDescriptorAction = null;
		DataStreamDescriptor = descriptor;
		return Self;
	}

	public SimulateIndexTemplateRequestDescriptor DataStream(Action<DataStreamVisibilityDescriptor> configure)
	{
		DataStreamValue = null;
		DataStreamDescriptor = null;
		DataStreamDescriptorAction = configure;
		return Self;
	}

	/// <summary>
	/// <para>Array of wildcard (`*`) expressions used to match the names of data streams and indices during creation.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor IndexPatterns(Elastic.Clients.Elasticsearch.Serverless.Indices? indexPatterns)
	{
		IndexPatternsValue = indexPatterns;
		return Self;
	}

	/// <summary>
	/// <para>Priority to determine index template precedence when a new data stream or index is created.<br/>The index template with the highest priority is chosen.<br/>If no priority is specified the template is treated as though it is of priority 0 (lowest priority).<br/>This number is not automatically generated by Elasticsearch.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor Priority(int? priority)
	{
		PriorityValue = priority;
		return Self;
	}

	/// <summary>
	/// <para>Version number used to manage index templates externally.<br/>This number is not automatically generated by Elasticsearch.</para>
	/// </summary>
	public SimulateIndexTemplateRequestDescriptor Version(long? version)
	{
		VersionValue = version;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		if (TemplateDescriptor is not null)
		{
			writer.WritePropertyName("template");
			JsonSerializer.Serialize(writer, TemplateDescriptor, options);
		}
		else if (TemplateDescriptorAction is not null)
		{
			writer.WritePropertyName("template");
			JsonSerializer.Serialize(writer, new IndexTemplateMappingDescriptor(TemplateDescriptorAction), options);
		}
		else if (TemplateValue is not null)
		{
			writer.WritePropertyName("template");
			JsonSerializer.Serialize(writer, TemplateValue, options);
		}

		if (MetaValue is not null)
		{
			writer.WritePropertyName("_meta");
			JsonSerializer.Serialize(writer, MetaValue, options);
		}

		if (AllowAutoCreateValue.HasValue)
		{
			writer.WritePropertyName("allow_auto_create");
			writer.WriteBooleanValue(AllowAutoCreateValue.Value);
		}

		if (ComposedOfValue is not null)
		{
			writer.WritePropertyName("composed_of");
			JsonSerializer.Serialize(writer, ComposedOfValue, options);
		}

		if (DataStreamDescriptor is not null)
		{
			writer.WritePropertyName("data_stream");
			JsonSerializer.Serialize(writer, DataStreamDescriptor, options);
		}
		else if (DataStreamDescriptorAction is not null)
		{
			writer.WritePropertyName("data_stream");
			JsonSerializer.Serialize(writer, new DataStreamVisibilityDescriptor(DataStreamDescriptorAction), options);
		}
		else if (DataStreamValue is not null)
		{
			writer.WritePropertyName("data_stream");
			JsonSerializer.Serialize(writer, DataStreamValue, options);
		}

		if (IndexPatternsValue is not null)
		{
			writer.WritePropertyName("index_patterns");
			JsonSerializer.Serialize(writer, IndexPatternsValue, options);
		}

		if (PriorityValue.HasValue)
		{
			writer.WritePropertyName("priority");
			writer.WriteNumberValue(PriorityValue.Value);
		}

		if (VersionValue is not null)
		{
			writer.WritePropertyName("version");
			JsonSerializer.Serialize(writer, VersionValue, options);
		}

		writer.WriteEndObject();
	}
}